const { defineConfig } = require('@vue/cli-service')
const path = require('path')
// import AutoImport from 'unplugin-auto-import/vite'
module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    open: true,
    // host: 'www.corho.com',
    // port: 8080,
    // 开启IP域名访问
    historyApiFallback: true,
    allowedHosts: 'all',
    client: {
      //当出现编译错误或警告时，在浏览器中是否显示全屏覆盖。  示例为只显示错误信息
      overlay: {
        runtimeErrors: false
      }
    }
  },
  // plugins: ['vue', 'vueJsx'],
  // plugin: [AutoImport({ imports: ['vue', 'vue-router', 'api', 'axios'] })],
  pluginOptions: {
    'style-resources-loader': {
      preProcessor: 'less',
      patterns: [
        path.join(__dirname, './src/assets/style/variables.less'),
        path.join(__dirname, './src/assets/style/mixins.less')
      ]
    }
  },
  chainWebpack: (config) => {
    config.plugin('html').tap((args) => {
      args[0].title = '稿定小卖部-优惠 便民 大众喜爱！'
      return args
    })
  },
  configureWebpack: {
    externals: {
      qc: 'QC'
    }
  }
  // chainWebpack: (config) => {
  //   config.module
  //     .rule('images')
  //     .use('url-loader')
  //     .loader('url-loader')
  //     .tap((options) => Object.assign(options, { limit: 10000 }))
  // }
})
